package com.yc.pre.entity.vo;

import cn.hutool.core.util.PhoneUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * @ClassName UserLoginVo
 * @Description 登录接口入参
 * @Date 2021/02/10 14:04:18
 * @Created by ccc-j
 * @email ccc-ju@outlook.com
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "登录入参")
public class UserLoginVo {

    @ApiModelProperty(value = "手机号", required = true, example = "15800000000")
    private String phone;

    @ApiModelProperty(value = "密码", required = true, example = "123456")
    private String password;

    @ApiModelProperty(value = "验证码", required = false, example = "aup5")
    private String picCode;

    public Boolean checkParam(){
        if(StringUtils.isBlank(this.phone) || StringUtils.isBlank(this.password)){
            return false;
        }
        if(!PhoneUtil.isMobile(phone)){
            return false;
        }
        return true;
    }

}
